#ifndef _HEADER_Switch_H
#include "Switch.h"
#endif

#ifndef _HEADER_HumiditySensor_H
#include "HumiditySensor.h"
#endif

#define _HEADER_VegetableGarden_H

//菜地类型
enum GardenTypeEnum {Cabbage=1,Radish};

/**
 * 菜地初始化参数定义
 * */
struct VegetableGardenConfig
{
    //菜地类型
    GardenTypeEnum gardenType = Cabbage;
    //菜地水路开关输出引脚
    int waterSwitchPort = -1;
    //菜地湿度探头输入引脚
    int humiditySensorPort = -1;
};

/**
 * 菜地定义
 * */
class VegetableGarden
{
public:
    bool canWatering;
public:
    //菜地类型
    GardenTypeEnum gardenType = Cabbage;
    //菜地水路开关
    Switch waterSwitch;
    //土壤湿度探头
    HumiditySensor humiditySensor;
    //设置菜地类型
    void setType(GardenTypeEnum type);
    //是否满足灌溉条件
    bool isCanWatering();
    //菜地初始化
    void init(VegetableGardenConfig* config);
    //打开、关闭菜地湿度开关
    void openWaterSwitch();
    void closeWaterSwitch();
    //输出菜地状态
    void toString(char* inStr);
};

